<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">




<title>深入解析Close()和Dispose()的区别！ - 周雪峰的博客 - 博客园</title>
<meta name="keywords" content="深入解析Close,和Dispose,的区别">



<link title="RSS" type="application/rss+xml" rel="alternate" href="http://www.cnblogs.com/xuefeng1982/rss">
<link title="RSD" type="application/rsd+xml" rel="EditURI" href="http://www.cnblogs.com/xuefeng1982/rsd.xml"> 
  



<link rel="stylesheet" type="text/css" href="index.css" media="all">
</head>
<body>
    <form name="Form1" method="post" action="http://www.cnblogs.com/xuefeng1982/archive/2010/01/13/1646450.html" id="Form1">
<div>
<input name="__EVENTTARGET" id="__EVENTTARGET" value="" type="hidden">
<input name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" type="hidden">
<input name="__VIEWSTATE" id="__VIEWSTATE" value="" type="hidden">
</div>




        
<!--done-->
<div id="header">
	
<!--done-->
<div class="header">
	<div class="headerText">
		<a id="Header1_HeaderTitle" class="headermaintitle" href="http://www.cnblogs.com/xuefeng1982/">周雪峰的博客</a><br>
		关注.NET技术与编程思想
	</div>
</div>

</div>

<div id="mytopmenu">
	
		<div id="mylinks">
<!--done-->
<a id="MyLinks1_HomeLink" class="menu" href="http://www.cnblogs.com/">博客园</a>&nbsp;&nbsp;
<a id="MyLinks1_MyHomeLink" class="menu" href="http://www.cnblogs.com/xuefeng1982/">首页</a>&nbsp;&nbsp;
<a href="http://space.cnblogs.com/" class="menu">社区</a>&nbsp;&nbsp;
<a id="MyLinks1_NewPostLink" class="menu" href="http://www.cnblogs.com/xuefeng1982/admin/EditPosts.aspx?opt=1">新随笔</a>&nbsp;&nbsp;
<a id="MyLinks1_ContactLink" class="menu" href="http://space.cnblogs.com/msg/send/%e5%91%a8%e9%9b%aa%e5%b3%b0">联系</a>&nbsp;&nbsp;
<a id="MyLinks1_Syndication" class="menu" href="http://www.cnblogs.com/xuefeng1982/rss">订阅</a><a id="MyLinks1_XMLLink" href="http://www.cnblogs.com/xuefeng1982/rss"><img src="xml.gif" alt="订阅" style="border-width: 0px;"></a>&nbsp;&nbsp;
<a id="MyLinks1_Admin" class="menu" href="http://www.cnblogs.com/xuefeng1982/admin/EditPosts.aspx">管理</a>
</div>
		<div id="mystats">
<!--done-->
随笔-55&nbsp;
评论-241&nbsp;
文章-0&nbsp;
trackbacks-0
</div>
	
</div>
<div id="centercontent">
	
					
<div class="post">
	<h1 class="postTitle"><a id="ctl04_TitleUrl" class="postTitle2" href="http://www.cnblogs.com/xuefeng1982/archive/2010/01/13/1646450.html">深入解析Close()和Dispose()的区别！</a></h1>
	很多人都认为Close()方法内部会调用Dispose()方法，所以并没有本质的区别！实际上这个看法不是很准确，对有<br><br>些类来说，的确Close()和Dispose()没有本质区别，但是对有些类来说并非如此！<br>首先，让我们看看我们最常使用的SqlConnection的Close()方法和Dispose()方法的区别：<br>SqlConnection类的Dispose()方法是继承于Component类的，源代码是这样的：<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public void Dispose() { <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dispose(true); //调用Dispose的一个带参数的重载<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GC.SuppressFinalize(this);&nbsp; //请求系统不要调用指定对象的终结器。<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; protected virtual void Dispose(bool disposing) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (disposing) { <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lock(this) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (site != null &amp;&amp; site.Container != null) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; site.Container.Remove(this);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (events != null) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EventHandler handler = (EventHandler)events[EventDisposed]; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (handler != null) handler(this, EventArgs.Empty); <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>SqlConnection类的Close()方法在MSDN中的说明是这样的：<br>关闭与数据库的连接。这是关闭任何打开连接的首选方法。 如果 SqlConnection 超出范围，则不会将其关闭。因<br><br>此，必须通过调用 Close 或 Dispose 显式关闭该连接。Close 和 Dispose 在功能上等效。如果连接池值 <br><br>Pooling 设置为 true 或 yes，则基础连接将返回到连接池。另一方面，如果 Pooling 设置为 false 或 no，则<br><br>会关闭到服务器的基础连接。 <br>看说明好象是Close()方法和Dispose()方法是类似的，实际上只是在关闭连接这个功能上等效，让我们看看Close<br><br>()方法的源代码：<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; override public void Close() { <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IntPtr hscp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Bid.ScopeEnter(out hscp, "&lt;sc.SqlConnection.Close|API&gt; %d#" , ObjectID); <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SqlStatistics statistics = null;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RuntimeHelpers.PrepareConstrainedRegions(); <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try {<br>#if DEBUG <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; object initialReliabilitySlotValue = Thread.GetData(TdsParser.ReliabilitySlot); <br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RuntimeHelpers.PrepareConstrainedRegions(); <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Thread.SetData(TdsParser.ReliabilitySlot, true);<br>#endif //DEBUG<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; statistics = SqlStatistics.StartTimer(Statistics); <br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // The lock here is to protect against the command.cancel / connection.close <br><br>race condition <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // The SqlInternalConnectionTds is set to OpenBusy during close, once this <br><br>happens the cast below will fail and <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // the command will no longer be cancelable.&nbsp; It might be desirable to be <br><br>able to cancel the close opperation, but this is<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // outside of the scope of Whidbey RTM.&nbsp; See (SqlCommand::Cancel) for other <br><br>lock. <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lock (InnerConnection) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; InnerConnection.CloseConnection(this, ConnectionFactory);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // does not require GC.KeepAlive(this) because of OnStateChange <br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (null != Statistics) { <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ADP.TimerCurrent(out _statistics._closeTimestamp); <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;#if DEBUG <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; finally {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Thread.SetData(TdsParser.ReliabilitySlot, initialReliabilitySlotValue);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <br>#endif //DEBUG<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch (System.OutOfMemoryException e) { <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Abort(e);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throw; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch (System.StackOverflowException e) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Abort(e);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throw; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch (System.Threading.ThreadAbortException e) { <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Abort(e); <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throw;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; finally {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SqlStatistics.StopTimer(statistics);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; finally {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SqlDebugContext&nbsp; sdc = _sdc; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _sdc = null; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Bid.ScopeLeave(ref hscp);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (sdc != null) { <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sdc.Dispose();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <br>可以看到Close()方法并没有调用Dispose()方法，虽然有一行sdc.Dispose();，但是这只是释放SqlDebugContext<br><br>实例，和SqlConnection.Dispose()方法没有关系！<br><br>那么区别在哪里呢？<br>Close()方法只是关闭了连接，然后这个连接被存储到连接池，所以在调用Close()方法以后，还是可以再通过<br><br>Open()方法来打开连接的<br>而调用Dispose()方法以后，这个连接就不能在使用了！<br>还有一个重要区别就是，当Close()方法并没有调用GC.SuppressFinalize(this);，这导致的直接后果就是在垃圾<br><br>回收的时候需要进行终止化操作，这会导致这个实例的“代龄”提升，从而极大的延迟这个对象的回收时间！<br><br>针对SqlConnection这个类来说，如果以后还需要使用这个连接可以使用Close()方法临时关闭连接，如果以后不需<br><br>要使用这个连接了，可以优先选用Dispose()方法来释放资源，当然你可以使用using关键字来简化这个过程，<br><br>OleDbConnection类和OdbcConnection类的源代码我没有找到，但是应该和SqlConnection类是类似的！<br><br>让我们在看一个我们常用的类，看看FileStream类的Close()方法和Dispose()方法有什么区别：<br>FileStream类的Close()方法是继承于Stream类的，源代码是这样的：<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public virtual void Close() <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dispose(true); <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GC.SuppressFinalize(this);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>FileStream类的Dispose()方法是继承于Stream类的，源代码是这样的：<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public void Dispose() <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Close(); <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>是一个标准的Dispose模式的实现，Close()方法调用的是带参数的Dispose方法，然后调用GC.SuppressFinalize<br><br>(this);请求系统不要调用指定对象的终结器。而Dispose（）方法直接调用Close()方法！<br>对于FileStream类来说，Close()方法和Dispose()方法是没有区别！<br>
<div id="digg_block">
<div id="div_digg">										
	<div class="diggit" onclick="DiggIt(1646450,43777,1)"> 
		<span class="diggnum" id="digg_count_1646450">1</span>
	</div>
	<div class="buryit" onclick="DiggIt(1646450,43777,2)"> 
		<span class="burynum" id="bury_count_1646450">0</span>
	</div>
	<div class="clear"></div>
	<span style="display: none;" id="span_isdigged_1646450">0</span>	
	<div class="diggword" id="digg_word_1646450">(请您对文章做出评价)</div>	
</div>
</div>
<div class="clear"></div>
<div id="post_next_prev">
<a href="http://www.cnblogs.com/xuefeng1982/archive/2010/01/12/1645018.html">« </a> 上一篇：<a href="http://www.cnblogs.com/xuefeng1982/archive/2010/01/12/1645018.html" title="发布于2010-01-12 13:07">基类构造函数和初始化器的执行顺序!</a><br>

</div>








	<div class="postDesc">posted on 2010-01-13 13:39 <a href="http://www.cnblogs.com/xuefeng1982/">周雪峰</a> 阅读(1823) <a href="#commentform">评论(12)</a> &nbsp;<a href="http://www.cnblogs.com/xuefeng1982/admin/EditPosts.aspx?postid=1646450">编辑</a> <a href="http://www.cnblogs.com/xuefeng1982/AddToFavorite.aspx?id=1646450">收藏</a> <a href="#" onclick="PutInWz();return false;">网摘</a>  </div>
</div>
<img src="1646450.html" height="1" width="1">

<!--
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
<rdf:Description
rdf:about="http://www.cnblogs.com/xuefeng1982/archive/2010/01/13/1646450.html"
dc:identifier="http://www.cnblogs.com/xuefeng1982/archive/2010/01/13/1646450.html"
dc:title=""
trackback:ping="http://www.cnblogs.com/xuefeng1982/services/trackbacks/1646450.aspx" />
</rdf:RDF>
-->

<a name="pagedcomment"></a>
<!--done-->
<br>
<b>评论:</b>
<div class="feedbackNoItems"><span id="span_comment_maxid" style="display: none;">1747120</span></div>
	

		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
			<a href="#1745946">#1楼</a><a name="1745946" id="comment_anchor_1745946"></a>
				2010-01-13 13:44 | <a id="Comments1_CommentList_ctl00_NameLink" href="http://www.cnblogs.com/unruledboy/" target="_top">灵感之源</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/%e7%81%b5%e6%84%9f%e4%b9%8b%e6%ba%90" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a><br>
				<div align="left"><span id="comment_body_1745946" class="blog_comment_body">using</span><br>&nbsp;&nbsp;<a onclick='ReplyComment("灵感之源",1745946,"ihzZH8KvV+mScCKwil0fknKUjpjG0ZQhPE1yXmIKRYROzTNU1HBQYA==")' href="http://www.cnblogs.com/xuefeng1982/archive/2010/01/13/1646450.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1745946,"ihzZH8KvV+mScCKwil0fknKUjpjG0ZQhPE1yXmIKRYROzTNU1HBQYA==")' href="http://www.cnblogs.com/xuefeng1982/archive/2010/01/13/1646450.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e7%81%b5%e6%84%9f%e4%b9%8b%e6%ba%90" target="_top">查看</a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl00_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl00$DeleteLink','')"></a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl00_EditLink"></a></div>
			</div>
			
			
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
			<a href="#1745956">#2楼</a><a name="1745956" id="comment_anchor_1745956"></a>
				2010-01-13 13:53 | <a id="Comments1_CommentList_ctl01_NameLink" href="http://www.cnblogs.com/xiaocaicai/" target="_top">.Net小菜菜</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/.Net%e5%b0%8f%e8%8f%9c%e8%8f%9c" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a><br>
				<div align="left"><span id="comment_body_1745956" class="blog_comment_body">学习了 太有钻研精神了</span><br>&nbsp;&nbsp;<a onclick='ReplyComment(".Net小菜菜",1745956,"udlbX3cNKvJPITu2ItEhPalmFK5PoCCHWCm8LVOOjoignSrd6QC8uw==")' href="http://www.cnblogs.com/xuefeng1982/archive/2010/01/13/1646450.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1745956,"udlbX3cNKvJPITu2ItEhPalmFK5PoCCHWCm8LVOOjoignSrd6QC8uw==")' href="http://www.cnblogs.com/xuefeng1982/archive/2010/01/13/1646450.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=.Net%e5%b0%8f%e8%8f%9c%e8%8f%9c" target="_top">查看</a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl01_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl01$DeleteLink','')"></a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl01_EditLink"></a></div>
			</div>
			
			
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
			<a href="#1745974">#3楼</a><a name="1745974" id="comment_anchor_1745974"></a>
				2010-01-13 14:01 | <a id="Comments1_CommentList_ctl02_NameLink" href="http://www.cnblogs.com/wangyh/" target="_top">Nick Wang (懒人王)</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/Nick+Wang+%28%e6%87%92%e4%ba%ba%e7%8e%8b%29" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a><br>
				<div align="left"><span id="comment_body_1745974" class="blog_comment_body">感觉完全是因为pool的原因</span><br>&nbsp;&nbsp;<a onclick='ReplyComment("Nick Wang (懒人王)",1745974,"gCYzdthH5Vxjnx93p+jR8MreiKteQ7ROUKtbJ3zgUgKQlPllg+xNxw==")' href="http://www.cnblogs.com/xuefeng1982/archive/2010/01/13/1646450.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1745974,"gCYzdthH5Vxjnx93p+jR8MreiKteQ7ROUKtbJ3zgUgKQlPllg+xNxw==")' href="http://www.cnblogs.com/xuefeng1982/archive/2010/01/13/1646450.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=Nick+Wang+%28%e6%87%92%e4%ba%ba%e7%8e%8b%29" target="_top">查看</a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl02_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl02$DeleteLink','')"></a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl02_EditLink"></a></div>
			</div>
			
			
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
			<a href="#1746103">#4楼</a><a name="1746103" id="comment_anchor_1746103"></a>
				2010-01-13 15:45 | <a id="Comments1_CommentList_ctl03_NameLink" href="http://www.cnblogs.com/jingkun/" target="_top">景坤</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/%e6%99%af%e5%9d%a4" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a><br>
				<div align="left"><span id="comment_body_1746103" class="blog_comment_body">very good.</span><br>&nbsp;&nbsp;<a onclick='ReplyComment("景坤",1746103,"GxO8ebansRSTaNcafV1XfTgLSz9mgZg72f2WxM3Ut9410pNoD1aGJA==")' href="http://www.cnblogs.com/xuefeng1982/archive/2010/01/13/1646450.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1746103,"GxO8ebansRSTaNcafV1XfTgLSz9mgZg72f2WxM3Ut9410pNoD1aGJA==")' href="http://www.cnblogs.com/xuefeng1982/archive/2010/01/13/1646450.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e6%99%af%e5%9d%a4" target="_top">查看</a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl03_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl03$DeleteLink','')"></a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl03_EditLink"></a></div>
			</div>
			
			
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
			<a href="#1746132">#5楼</a><a name="1746132" id="comment_anchor_1746132"></a>
				2010-01-13 16:10 | <a id="Comments1_CommentList_ctl04_NameLink" href="http://home.cnblogs.com/99090/" target="_top">西南烟雨</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/%e8%a5%bf%e5%8d%97%e7%83%9f%e9%9b%a8" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a><br>
				<div align="left"><span id="comment_body_1746132" class="blog_comment_body">很好，学习了</span><br>&nbsp;&nbsp;<a onclick='ReplyComment("西南烟雨",1746132,"GwUpIA4Rmq4diWeX/Ur3iulH1VFhZHzWUDNMrEmf911z4SI49rcn5w==")' href="http://www.cnblogs.com/xuefeng1982/archive/2010/01/13/1646450.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1746132,"GwUpIA4Rmq4diWeX/Ur3iulH1VFhZHzWUDNMrEmf911z4SI49rcn5w==")' href="http://www.cnblogs.com/xuefeng1982/archive/2010/01/13/1646450.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e8%a5%bf%e5%8d%97%e7%83%9f%e9%9b%a8" target="_top">查看</a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl04_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl04$DeleteLink','')"></a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl04_EditLink"></a></div>
			</div>
			
			
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
			<a href="#1746195">#6楼</a><a name="1746195" id="comment_anchor_1746195"></a>
				2010-01-13 17:11 | <a id="Comments1_CommentList_ctl05_NameLink" href="http://www.cnblogs.com/netec/" target="_top">沉默杨仔</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/%e6%b2%89%e9%bb%98%e6%9d%a8%e4%bb%94" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a><br>
				<div align="left"><span id="comment_body_1746195" class="blog_comment_body">按楼主的解释<br>可不可以这样理解。在connection中<br>sqlconnection connection=new sqlconnection(连接字符串)<br>connection.open();<br>helper.exectute(sql)<br>connection.close()<br>connection.open();<br>helper.exectute(sql1)<br>connection.close()<br>是可以执行的<br><br>而<br>sqlconnection connection=new sqlconnection(连接字符串)<br>connection.open();<br>helper.exectute(sql)<br>connection.Dispose()<br>connection.open();<br>helper.exectute(sql1)<br>connection.close()<br>第二段就不可以执行了。可以这样理解否？</span><br>&nbsp;&nbsp;<a onclick='ReplyComment("沉默杨仔",1746195,"DV3txMLdtJdkkTzpeM4bCZVK8jqI3TuGDT1GS1zlJtSGPjHxPrdk5Q==")' href="http://www.cnblogs.com/xuefeng1982/archive/2010/01/13/1646450.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1746195,"DV3txMLdtJdkkTzpeM4bCZVK8jqI3TuGDT1GS1zlJtSGPjHxPrdk5Q==")' href="http://www.cnblogs.com/xuefeng1982/archive/2010/01/13/1646450.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e6%b2%89%e9%bb%98%e6%9d%a8%e4%bb%94" target="_top">查看</a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl05_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl05$DeleteLink','')"></a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl05_EditLink"></a></div>
			</div>
			
			
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
			<a href="#1746196">#7楼</a><a name="1746196" id="comment_anchor_1746196"></a>
				2010-01-13 17:11 | <a id="Comments1_CommentList_ctl06_NameLink" href="http://www.cnblogs.com/SeaSun/" target="_top">SeaSunK</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/SeaSunK" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a><br>
				<div align="left"><span id="comment_body_1746196" class="blog_comment_body">FileStream类的Close()方法是继承于Stream类的，源代码是这样的：<br>        public virtual void Close() <br>        {<br>            Dispose(true); <br>            GC.SuppressFinalize(this);<br>        }<br>FileStream类的Close()方法是继承于Stream类的，源代码是这样的：<br>        public void Dispose() <br>        {<br>            Close(); <br>        }</span><br>&nbsp;&nbsp;<a onclick='ReplyComment("SeaSunK",1746196,"cYGruq5lNt0iywA5z2WpbR7tijbDUFAK3S38jmc0IudCLguVpsR62A==")' href="http://www.cnblogs.com/xuefeng1982/archive/2010/01/13/1646450.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1746196,"cYGruq5lNt0iywA5z2WpbR7tijbDUFAK3S38jmc0IudCLguVpsR62A==")' href="http://www.cnblogs.com/xuefeng1982/archive/2010/01/13/1646450.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=SeaSunK" target="_top">查看</a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl06_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl06$DeleteLink','')"></a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl06_EditLink"></a></div>
			</div>
			
			
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
			<a href="#1746259">#8楼</a><a name="1746259" id="comment_anchor_1746259"></a>[<span class="louzhu">楼主</span>]
				2010-01-13 17:57 | <a id="Comments1_CommentList_ctl07_NameLink" href="http://www.cnblogs.com/xuefeng1982/" target="_top">周雪峰</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/%e5%91%a8%e9%9b%aa%e5%b3%b0" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a><br>
				<div align="left"><span id="comment_body_1746259" class="blog_comment_body"><fieldset class="comment_quote"><legend><a href="#1746196" title="查看引用原文">引用</a></legend>SeaSunK：<br>FileStream类的Close()方法是继承于Stream类的，源代码是这样的：<br>        public virtual void Close() <br>        {<br>            Dispose(true); <br>            GC.SuppressFinalize(this);<br>        }<br>FileStream类的Close()方法是继承于Stream类的，源代码是这样的：<br>        public void Dispose() <br>        {<br>            Close(); <br>        }</fieldset><br>多谢指出问题啊！已经修改了！</span><br>&nbsp;&nbsp;<a onclick='ReplyComment("周雪峰",1746259,"MbXyVVVbgwp0jLn7rkupKvyE6eZhfhBwsZerVPL7ssfYBjOTuAiZWw==")' href="http://www.cnblogs.com/xuefeng1982/archive/2010/01/13/1646450.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1746259,"MbXyVVVbgwp0jLn7rkupKvyE6eZhfhBwsZerVPL7ssfYBjOTuAiZWw==")' href="http://www.cnblogs.com/xuefeng1982/archive/2010/01/13/1646450.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e5%91%a8%e9%9b%aa%e5%b3%b0" target="_top">查看</a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl07_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl07$DeleteLink','')"></a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl07_EditLink"></a></div>
			</div>
			
			
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
			<a href="#1746260">#9楼</a><a name="1746260" id="comment_anchor_1746260"></a>[<span class="louzhu">楼主</span>]
				2010-01-13 17:58 | <a id="Comments1_CommentList_ctl08_NameLink" href="http://www.cnblogs.com/xuefeng1982/" target="_top">周雪峰</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/%e5%91%a8%e9%9b%aa%e5%b3%b0" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a><br>
				<div align="left"><span id="comment_body_1746260" class="blog_comment_body"><fieldset class="comment_quote"><legend><a href="#1746195" title="查看引用原文">引用</a></legend>沉默杨仔：<br>按楼主的解释<br>可不可以这样理解。在connection中<br>sqlconnection connection=new sqlconnection(连接字符串)<br>connection.open();<br>helper.exectute(sql)<br>connection.close()<br>connection.open();<br>helper.exectute(sql1)<br>connection.close()<br>是可以执行的<br><br>而<br>sqlconnection connection=new sqlconnection(连接字符串)<br>connection.open();<br>helper.exectute(sql)<br>connection.Dispose()<br>connection.open();<br>helper.exectute(sql1)<br>connection.close()<br>第二段就不可以执行了。可以这样理解否？</fieldset><br>就是这个意思！</span><br>&nbsp;&nbsp;<a onclick='ReplyComment("周雪峰",1746260,"MbXyVVVbgwp0jLn7rkupKvyE6eZhfhBwsZerVPL7ssfYBjOTuAiZWw==")' href="http://www.cnblogs.com/xuefeng1982/archive/2010/01/13/1646450.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1746260,"MbXyVVVbgwp0jLn7rkupKvyE6eZhfhBwsZerVPL7ssfYBjOTuAiZWw==")' href="http://www.cnblogs.com/xuefeng1982/archive/2010/01/13/1646450.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e5%91%a8%e9%9b%aa%e5%b3%b0" target="_top">查看</a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl08_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl08$DeleteLink','')"></a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl08_EditLink"></a></div>
			</div>
			
			
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
			<a href="#1746398">#10楼</a><a name="1746398" id="comment_anchor_1746398"></a>
				2010-01-13 21:38 | <a id="Comments1_CommentList_ctl09_NameLink" href="http://www.cnblogs.com/ilovedotnet/" target="_top">ilovedotnet</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/ilovedotnet" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a><br>
				<div align="left"><span id="comment_body_1746398" class="blog_comment_body">一直不是很明白，今天终于清楚了，看来还是要看源码啊，多谢楼主！</span><br>&nbsp;&nbsp;<a onclick='ReplyComment("ilovedotnet",1746398,"SA1CHck+gIqNqRYWiY8b6HAT02I2j0vGen0vGwfIjXDUyXRfG7LaUg==")' href="http://www.cnblogs.com/xuefeng1982/archive/2010/01/13/1646450.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1746398,"SA1CHck+gIqNqRYWiY8b6HAT02I2j0vGen0vGwfIjXDUyXRfG7LaUg==")' href="http://www.cnblogs.com/xuefeng1982/archive/2010/01/13/1646450.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=ilovedotnet" target="_top">查看</a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl09_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl09$DeleteLink','')"></a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl09_EditLink"></a></div>
			</div>
			
			
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
			<a href="#1746515">#11楼</a><a name="1746515" id="comment_anchor_1746515"></a>
				2010-01-14 08:51 | <a id="Comments1_CommentList_ctl10_NameLink" href="http://home.cnblogs.com/103770/" target="_top">小驴</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/%e5%b0%8f%e9%a9%b4" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a><br>
				<div align="left"><span id="comment_body_1746515" class="blog_comment_body">呵呵，不错，又知道了点内因的知识！表示感谢！</span><br>&nbsp;&nbsp;<a onclick='ReplyComment("小驴",1746515,"bECii2zVzPjRbDBPMH1FhtkSqQGjdTiZPAwlP46pDG7Bf0Ucb7QjnA==")' href="http://www.cnblogs.com/xuefeng1982/archive/2010/01/13/1646450.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1746515,"bECii2zVzPjRbDBPMH1FhtkSqQGjdTiZPAwlP46pDG7Bf0Ucb7QjnA==")' href="http://www.cnblogs.com/xuefeng1982/archive/2010/01/13/1646450.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e5%b0%8f%e9%a9%b4" target="_top">查看</a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl10_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl10$DeleteLink','')"></a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl10_EditLink"></a></div>
			</div>
			
			
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
			<a href="#1747120">#12楼</a><a name="1747120" id="comment_anchor_1747120"></a><a name="Post"></a>
				2010-01-14 16:31 | <a id="Comments1_CommentList_ctl11_NameLink" href="http://www.cnblogs.com/SeaSun/" target="_top">SeaSunK</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/SeaSunK" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a><br>
				<div align="left"><span id="comment_body_1747120" class="blog_comment_body"><a href="#1746195" title="查看所回复的评论">@</a>沉默杨仔<br>@周雪峰<br>第二段应该会抛出异常</span><br>&nbsp;&nbsp;<a onclick='ReplyComment("SeaSunK",1747120,"cYGruq5lNt0iywA5z2WpbR7tijbDUFAK3S38jmc0IudCLguVpsR62A==")' href="http://www.cnblogs.com/xuefeng1982/archive/2010/01/13/1646450.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1747120,"cYGruq5lNt0iywA5z2WpbR7tijbDUFAK3S38jmc0IudCLguVpsR62A==")' href="http://www.cnblogs.com/xuefeng1982/archive/2010/01/13/1646450.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=SeaSunK" target="_top">查看</a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl11_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl11$DeleteLink','')"></a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl11_EditLink"></a></div>
			</div>
			
			
		</div>
	





<div id="ctl05_comment_form" class="commentform">




<div id="ctl05_divLoginPannel">
<div class="login_tips">注册用户登录后才能发表评论，请 <a href="http://passport.cnblogs.com/login.aspx?ReturnUrl=http%3a%2f%2fwww.cnblogs.com%2fxuefeng1982%2farchive%2f2010%2f01%2f13%2f1646450.html%3flogin%3d1%23commentform" class="underline">登录</a> 或 <a href="http://passport.cnblogs.com/register.aspx?ReturnUrl=http%3a%2f%2fwww.cnblogs.com%2fxuefeng1982%2farchive%2f2010%2f01%2f13%2f1646450.html%23Bottom2" class="underline">注册</a> 。</div>
</div>

<div class="itnews c_ad_block" id="itnews">
<a href="http://news.cnblogs.com/" target="_top">IT新闻</a>:<br>

          ·  <a href="http://news.cnblogs.com/n/55117/" target="_top">在地球轨道上如何使用Outlook</a><br>
	
          ·  <a href="http://news.cnblogs.com/n/55115/" target="_top">微软必应推域名缩略服务binged.it</a><br>
	
          ·  <a href="http://news.cnblogs.com/n/55114/" target="_top">谷歌联手亚马逊在英国推出Android音乐商店</a><br>
	
          ·  <a href="http://news.cnblogs.com/n/55112/" target="_top">Facebook成为Apache软件基金会黄金赞助商</a><br>
	
          ·  <a href="http://news.cnblogs.com/n/55111/" target="_top">IBM荣获2009年美国专利申请冠军</a><br>
	
</div>


<div id="ad_under_comment" class="c_ad_block">
<a href="http://a4.yeshj.com/rd/34138/" target="_top">每天10分钟，轻松学英语</a><br><br>
<div id="google_ads_div_cnblogs_blogpost_bottom1">
<iframe src="index_1.html" style="border: 0pt none ;" marginheight="0" marginwidth="0" name="google_ads_iframe_cnblogs_blogpost_bottom1" id="google_ads_iframe_cnblogs_blogpost_bottom1" scrolling="no" frameborder="0" height="60" width="468"></iframe></div>

<br>
<div id="google_ads_div_cnblogs_blogpost_bottom">
<iframe src="index_2.html" style="border: 0pt none ;" marginheight="0" marginwidth="0" name="google_ads_iframe_cnblogs_blogpost_bottom" id="google_ads_iframe_cnblogs_blogpost_bottom" scrolling="no" frameborder="0" height="250" width="300"></iframe></div>

</div>
<div id="site_nav_under" class="c_ad_block">
网站导航：<br>
<a href="http://www.cnblogs.com/" target="_top">博客园首页</a> &nbsp;<a href="http://news.cnblogs.com/" target="_top">IT新闻</a> &nbsp;<a href="http://home.cnblogs.com/" target="_top">个人主页</a> &nbsp;<a href="http://home.cnblogs.com/ing/" target="_top">闪存</a> &nbsp;<a href="http://job.cnblogs.com/" target="_top">程序员招聘</a> &nbsp;<a href="http://space.cnblogs.com/" target="_top">社区</a> &nbsp;<a href="http://space.cnblogs.com/q/" target="_top">博问</a> &nbsp;<a href="http://wz.cnblogs.com/" target="_top">网摘</a>
</div>
<div id="ad_under_comment2" class="c_ad_block">
<a href="http://www.china-pub.com/STATIC07/0912/zh_ndcx_091212.asp" target="_top"><img src="chinapub_20091222.jpg" alt="" style="border: 0px none ;"></a><br>
<a href="http://www.china-pub.com/itbook/" target="_top">China-pub 计算机图书网上专卖店！6.5万品种2-8折！</a><br>
<a href="http://www.china-pub.com/static07/0901/zh_jueba_090121.asp" target="_top">China-Pub 计算机绝版图书按需印刷服务</a><br>
</div>

<div id="relative_search"><br><b>在知识库中查看：</b><br> <a href="http://kb.cnblogs.com/a/1646450/">深入解析Close()和Dispose()的区别！</a></div>

</div>


				
</div>
<div id="leftcontent" style="display: inline;">
	
		<div id="leftcontentcontainer">
			
<!--done-->
<div class="newsItem">
	<div id="profile_block"><a href="http://home.cnblogs.com/xuefeng1982/" target="_top">我的主页</a>&nbsp; <a href="http://home.cnblogs.com/xuefeng1982/detail/" target="_top">个人资料</a><br><a href="http://home.cnblogs.com/xuefeng1982/ing/" target="_top">我的闪存</a>&nbsp; <a href="http://space.cnblogs.com/msg/send/%e5%91%a8%e9%9b%aa%e5%b3%b0" target="_top">发短消息</a></div>
</div>

			<table id="Calendar1_entryCal" class="Cal" title="Calendar" style="border-style: solid; border-width: 1px; border-collapse: collapse;" border="0" cellpadding="0" cellspacing="0">
	<tbody><tr><td colspan="7" style="background-color: Silver;"><table class="CalTitle" style="width: 100%; border-collapse: collapse;" border="0" cellspacing="0">
		<tbody><tr><td class="CalNextPrev" style="width: 15%;"><a href="javascript:__doPostBack('Calendar1$entryCal','V3622')" style="color: Black;" title="Go to the previous month">&lt;</a></td><td style="width: 70%;" align="center">2010年1月</td><td class="CalNextPrev" style="width: 15%;" align="right"><a href="javascript:__doPostBack('Calendar1$entryCal','V3684')" style="color: Black;" title="Go to the next month">&gt;</a></td></tr>
	</tbody></table></td></tr><tr><th class="CalDayHeader" abbr="日" scope="col" align="center">日</th><th class="CalDayHeader" abbr="一" scope="col" align="center">一</th><th class="CalDayHeader" abbr="二" scope="col" align="center">二</th><th class="CalDayHeader" abbr="三" scope="col" align="center">三</th><th class="CalDayHeader" abbr="四" scope="col" align="center">四</th><th class="CalDayHeader" abbr="五" scope="col" align="center">五</th><th class="CalDayHeader" abbr="六" scope="col" align="center">六</th></tr><tr><td class="CalOtherMonthDay" style="width: 14%;" align="center">27</td><td class="CalOtherMonthDay" style="width: 14%;" align="center">28</td><td class="CalOtherMonthDay" style="width: 14%;" align="center">29</td><td class="CalOtherMonthDay" style="width: 14%;" align="center">30</td><td class="CalOtherMonthDay" style="width: 14%;" align="center">31</td><td style="width: 14%;" align="center">1</td><td class="CalWeekendDay" style="width: 14%;" align="center">2</td></tr><tr><td class="CalWeekendDay" style="width: 14%;" align="center">3</td><td style="width: 14%;" align="center">4</td><td style="width: 14%;" align="center">5</td><td style="width: 14%;" align="center">6</td><td style="width: 14%;" align="center"><a href="http://www.cnblogs.com/xuefeng1982/archive/2010/1/7.html"><u>7</u></a></td><td style="width: 14%;" align="center">8</td><td class="CalWeekendDay" style="width: 14%;" align="center">9</td></tr><tr><td class="CalWeekendDay" style="width: 14%;" align="center">10</td><td style="width: 14%;" align="center">11</td><td style="width: 14%;" align="center"><a href="http://www.cnblogs.com/xuefeng1982/archive/2010/1/12.html"><u>12</u></a></td><td style="width: 14%;" align="center"><a href="http://www.cnblogs.com/xuefeng1982/archive/2010/1/13.html"><u>13</u></a></td><td style="width: 14%;" align="center">14</td><td style="width: 14%;" align="center">15</td><td class="CalTodayDay" style="width: 14%;" align="center">16</td></tr><tr><td class="CalWeekendDay" style="width: 14%;" align="center">17</td><td style="width: 14%;" align="center">18</td><td style="width: 14%;" align="center">19</td><td style="width: 14%;" align="center">20</td><td style="width: 14%;" align="center">21</td><td style="width: 14%;" align="center">22</td><td class="CalWeekendDay" style="width: 14%;" align="center">23</td></tr><tr><td class="CalWeekendDay" style="width: 14%;" align="center">24</td><td style="width: 14%;" align="center">25</td><td style="width: 14%;" align="center">26</td><td style="width: 14%;" align="center">27</td><td style="width: 14%;" align="center">28</td><td style="width: 14%;" align="center">29</td><td class="CalWeekendDay" style="width: 14%;" align="center">30</td></tr><tr><td class="CalWeekendDay" style="width: 14%;" align="center">31</td><td class="CalOtherMonthDay" style="width: 14%;" align="center">1</td><td class="CalOtherMonthDay" style="width: 14%;" align="center">2</td><td class="CalOtherMonthDay" style="width: 14%;" align="center">3</td><td class="CalOtherMonthDay" style="width: 14%;" align="center">4</td><td class="CalOtherMonthDay" style="width: 14%;" align="center">5</td><td class="CalOtherMonthDay" style="width: 14%;" align="center">6</td></tr>
</tbody></table>
<br>
			

<div class="mySearch">
<h3 class="catListTitle">搜索</h3>
<div class="div_my_zzk"><input value="" id="q" onkeydown="return zzk_go_enter(event);" class="input_my_zzk" type="text">&nbsp;<input onclick="zzk_go()" value="找找看" id="btnZzk" class="btn_my_zzk" type="button"></div>
</div>
<h3>常用链接</h3>
<ul>

		<li><a id="SingleColumn1_ctl02_rptMainLinks_ctl00_lnkLinkItem" href="http://www.cnblogs.com/xuefeng1982/MyPosts.html">我的随笔</a></li>
	
		<li><a id="SingleColumn1_ctl02_rptMainLinks_ctl01_lnkLinkItem" href="http://home.cnblogs.com/xuefeng1982/">我的空间</a></li>
	
		<li><a id="SingleColumn1_ctl02_rptMainLinks_ctl02_lnkLinkItem" href="http://space.cnblogs.com/msg/recent">我的短信</a></li>
	
		<li><a id="SingleColumn1_ctl02_rptMainLinks_ctl03_lnkLinkItem" href="http://www.cnblogs.com/xuefeng1982/MyComments.html">我的评论</a></li>
	
<li><a id="itemListLink" onclick="this.blur();WarpClass('itemListLink', 'itemListLin_con');return false;" href="#">更多链接</a></li>
</ul>
<div id="itemListLin_con" style="display: none;">
<ul>
		<li><a id="SingleColumn1_ctl02_repeaterLinks_ctl01_lnkLinkItem" title="我发表过评论的随笔" href="http://www.cnblogs.com/xuefeng1982/OtherPosts.html">我的参与</a></li>
	
		<li><a id="SingleColumn1_ctl02_repeaterLinks_ctl02_lnkLinkItem" href="http://www.cnblogs.com/xuefeng1982/MyNews.html">我的新闻</a></li>
	
		<li><a id="SingleColumn1_ctl02_repeaterLinks_ctl03_lnkLinkItem" href="http://www.cnblogs.com/xuefeng1982/RecentComments.html">最新评论</a></li>
	
		<li><a id="SingleColumn1_ctl02_repeaterLinks_ctl04_lnkLinkItem" href="http://www.cnblogs.com/xuefeng1982/tag/">我的标签</a></li>
	</ul>
</div>
		<h3 class="catListTitle">随笔档案</h3>
		
				<ul class="catList">
			
				<li class="catListItem"> <a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl01_Link" class="listitem" href="http://www.cnblogs.com/xuefeng1982/archive/2010/01.html">2010年1月 (3)</a></li>
			
				<li class="catListItem"> <a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl02_Link" class="listitem" href="http://www.cnblogs.com/xuefeng1982/archive/2009/12.html">2009年12月 (2)</a></li>
			
				<li class="catListItem"> <a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl03_Link" class="listitem" href="http://www.cnblogs.com/xuefeng1982/archive/2009/11.html">2009年11月 (3)</a></li>
			
				<li class="catListItem"> <a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl04_Link" class="listitem" href="http://www.cnblogs.com/xuefeng1982/archive/2009/10.html">2009年10月 (3)</a></li>
			
				<li class="catListItem"> <a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl05_Link" class="listitem" href="http://www.cnblogs.com/xuefeng1982/archive/2009/09.html">2009年9月 (3)</a></li>
			
				<li class="catListItem"> <a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl06_Link" class="listitem" href="http://www.cnblogs.com/xuefeng1982/archive/2009/08.html">2009年8月 (4)</a></li>
			
				<li class="catListItem"> <a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl07_Link" class="listitem" href="http://www.cnblogs.com/xuefeng1982/archive/2009/07.html">2009年7月 (3)</a></li>
			
				<li class="catListItem"> <a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl08_Link" class="listitem" href="http://www.cnblogs.com/xuefeng1982/archive/2009/06.html">2009年6月 (4)</a></li>
			
				<li class="catListItem"> <a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl09_Link" class="listitem" href="http://www.cnblogs.com/xuefeng1982/archive/2009/05.html">2009年5月 (5)</a></li>
			
				<li class="catListItem"> <a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl10_Link" class="listitem" href="http://www.cnblogs.com/xuefeng1982/archive/2009/02.html">2009年2月 (11)</a></li>
			
				<li class="catListItem"> <a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl11_Link" class="listitem" href="http://www.cnblogs.com/xuefeng1982/archive/2008/11.html">2008年11月 (6)</a></li>
			
				<li class="catListItem"> <a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl12_Link" class="listitem" href="http://www.cnblogs.com/xuefeng1982/archive/2008/10.html">2008年10月 (6)</a></li>
			
				<li class="catListItem"> <a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl13_Link" class="listitem" href="http://www.cnblogs.com/xuefeng1982/archive/2008/09.html">2008年9月 (1)</a></li>
			
				</ul>
			
	
		<h3 class="catListTitle">相册</h3>
		
				<ul class="catList">
			
				<li class="catListItem"> <a id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl01_Link" class="listitem" href="http://www.cnblogs.com/xuefeng1982/gallery/174306.html">我的像册</a></li>
			
				</ul>
			
	


<h3 class="catListTitle">最新评论
	<a id="SingleColumn1__a835fb_RSSHyperlink1" href="http://www.cnblogs.com/xuefeng1982/CommentsRSS.aspx"><img src="xml.gif" style="border-width: 0px;"></a></h3>
<div class="RecentComment" id="RecentComments">
	
			<ul>
		
			<li style="">
				<a id="SingleColumn1__a835fb_CommentList_ctl01_Hyperlink1" href="http://www.cnblogs.com/xuefeng1982/archive/2010/01/13/1646450.html#1747120">1.&nbsp;Re:深入解析Close()和Dispose()的区别！</a>
			</li>
			<li style="">
				@沉默杨仔
@周雪峰
第二段应该会抛出异常
			</li>
			<li style="text-align: right; margin-right: 4px;">
				--SeaSunK</li>
		
			<li style="">
				<a id="SingleColumn1__a835fb_CommentList_ctl02_Hyperlink1" href="http://www.cnblogs.com/xuefeng1982/archive/2010/01/13/1646450.html#1746515">2.&nbsp;Re:深入解析Close()和Dispose()的区别！</a>
			</li>
			<li style="">
				呵呵，不错，又知道了点内因的知识！表示感谢！
			</li>
			<li style="text-align: right; margin-right: 4px;">
				--小驴</li>
		
			<li style="">
				<a id="SingleColumn1__a835fb_CommentList_ctl03_Hyperlink1" href="http://www.cnblogs.com/xuefeng1982/archive/2010/01/13/1646450.html#1746398">3.&nbsp;Re:深入解析Close()和Dispose()的区别！</a>
			</li>
			<li style="">
				一直不是很明白，今天终于清楚了，看来还是要看源码啊，多谢楼主！
			</li>
			<li style="text-align: right; margin-right: 4px;">
				--ilovedotnet</li>
		
			<li style="">
				<a id="SingleColumn1__a835fb_CommentList_ctl04_Hyperlink1" href="http://www.cnblogs.com/xuefeng1982/archive/2010/01/12/1645018.html#1746347">4.&nbsp;Re:基类构造函数和初始化器的执行顺序!</a>
			</li>
			<li style="">
				我的理解:
一个类在其构造方法内可能需要使用其字段完成某些功能,或者通过构造方法上的参数为其字段赋值等等.所以,如果字段在没有初始化完成时是不会调用构造方法的.
这就好像一辆汽车必需先将其组成的部分,...
			</li>
			<li style="text-align: right; margin-right: 4px;">
				--碧海清天</li>
		
			<li style="">
				<a id="SingleColumn1__a835fb_CommentList_ctl05_Hyperlink1" href="http://www.cnblogs.com/xuefeng1982/archive/2010/01/13/1646450.html#1746260">5.&nbsp;Re:深入解析Close()和Dispose()的区别！</a>
			</li>
			<li style="">
				[quote]沉默杨仔：
按楼主的解释
可不可以这样理解。在connection中
sqlconnection connection=new sqlconnection(连接字符串)
connecti...
			</li>
			<li style="text-align: right; margin-right: 4px;">
				--周雪峰</li>
		
			</ul>
		
</div>

<h3 class="catListTitle">阅读排行榜</h3>
<div class="RecentComment" id="TopViewPosts"> 
	
			<ul style="">
		
			<li>
				<a id="SingleColumn1_ctl06_TopList_ctl01_Hyperlink1" href="http://www.cnblogs.com/xuefeng1982/archive/2009/02/18/1393166.html">1.&nbsp;谈谈C#的私有成员的一个有趣的现象！(2063)</a>
			</li>
		
			<li>
				<a id="SingleColumn1_ctl06_TopList_ctl02_Hyperlink1" href="http://www.cnblogs.com/xuefeng1982/archive/2009/10/09/1579816.html">2.&nbsp;从内存布局角度谈谈值类型和引用类型！(1917)</a>
			</li>
		
			<li>
				<a id="SingleColumn1_ctl06_TopList_ctl03_Hyperlink1" href="http://www.cnblogs.com/xuefeng1982/archive/2009/11/09/1598956.html">3.&nbsp;Assembly.Load()方法，Assembly.LoadFrom()方法，Assembly.LoadFile()方法的区别！(1899)</a>
			</li>
		
			<li>
				<a id="SingleColumn1_ctl06_TopList_ctl04_Hyperlink1" href="http://www.cnblogs.com/xuefeng1982/archive/2009/11/13/1602358.html">4.&nbsp;谈谈值类型与null的判等比较！(1864)</a>
			</li>
		
			<li>
				<a id="SingleColumn1_ctl06_TopList_ctl05_Hyperlink1" href="http://www.cnblogs.com/xuefeng1982/archive/2010/01/13/1646450.html">5.&nbsp;深入解析Close()和Dispose()的区别！(1823)</a>
			</li>
		
			</ul>
		
</div>

<h3 class="catListTitle">评论排行榜</h3>
<div class="RecentComment" id="TopCommentsPosts">
	
			<ul style="">
		
			<li>
				<a id="SingleColumn1_ctl07_TopList_ctl01_Hyperlink1" href="http://www.cnblogs.com/xuefeng1982/archive/2009/02/18/1393166.html">1.&nbsp;谈谈C#的私有成员的一个有趣的现象！(61)</a>
			</li>
		
			<li>
				<a id="SingleColumn1_ctl07_TopList_ctl02_Hyperlink1" href="http://www.cnblogs.com/xuefeng1982/archive/2009/11/13/1602358.html">2.&nbsp;谈谈值类型与null的判等比较！(23)</a>
			</li>
		
			<li>
				<a id="SingleColumn1_ctl07_TopList_ctl03_Hyperlink1" href="http://www.cnblogs.com/xuefeng1982/archive/2009/02/21/1395493.html">3.&nbsp;C#l编译器是否会为值类型生成默认的构造函数！(17)</a>
			</li>
		
			<li>
				<a id="SingleColumn1_ctl07_TopList_ctl04_Hyperlink1" href="http://www.cnblogs.com/xuefeng1982/archive/2010/01/13/1646450.html">4.&nbsp;深入解析Close()和Dispose()的区别！(12)</a>
			</li>
		
			<li>
				<a id="SingleColumn1_ctl07_TopList_ctl05_Hyperlink1" href="http://www.cnblogs.com/xuefeng1982/archive/2009/12/06/1618251.html">5.&nbsp;深入解析值类型的初始化过程！(12)</a>
			</li>
		
			</ul>
		
</div>
<h3 class="catListTitle">60天内阅读排行</h3>
<div class="RecentComment">
	
			<ul>
		
			<li>
				<a id="SingleColumn1__2dd400f_TopList_ctl01_Hyperlink1" href="http://www.cnblogs.com/xuefeng1982/archive/2010/01/13/1646450.html">1.&nbsp;深入解析Close()和Dispose()的区别！(1823)</a>
			</li>
		
			<li>
				<a id="SingleColumn1__2dd400f_TopList_ctl02_Hyperlink1" href="http://www.cnblogs.com/xuefeng1982/archive/2009/12/06/1618251.html">2.&nbsp;深入解析值类型的初始化过程！(1190)</a>
			</li>
		
			<li>
				<a id="SingleColumn1__2dd400f_TopList_ctl03_Hyperlink1" href="http://www.cnblogs.com/xuefeng1982/archive/2009/12/05/1617579.html">3.&nbsp;通过string.Split()方法，谈谈VB.NET编译器和C#编译器的一点差别！(1094)</a>
			</li>
		
			<li>
				<a id="SingleColumn1__2dd400f_TopList_ctl04_Hyperlink1" href="http://www.cnblogs.com/xuefeng1982/archive/2010/01/12/1645018.html">4.&nbsp;基类构造函数和初始化器的执行顺序!(1091)</a>
			</li>
		
			<li>
				<a id="SingleColumn1__2dd400f_TopList_ctl05_Hyperlink1" href="http://www.cnblogs.com/xuefeng1982/archive/2010/01/07/1641482.html">5.&nbsp;如何去掉TabControl控件默认添加的TabPage(81)</a>
			</li>
		
			</ul>
		
</div></div>
	
</div>

<!--done-->
<div class="footer">
	Powered by: <a href="http://www.cnblogs.com/">博客园</a>	模板提供：<a href="http://blog.hjenglish.com/">沪江博客</a>
	Copyright ©2010 周雪峰
</div>



    </form>
	
	
      
    
    
    
</body>
</html>
